1 point
center(const point
&p
, const point
&q
, const point
&r
) {
6 double d
= ax
*by
- bx
*ay
;
9 printf("Points are collinear!\n");
13 double cx
= (q
.x
+ p
.x
) / 2;
14 double cy
= (q
.y
+ p
.y
) / 2;
15 double dx
= (r
.x
+ p
.x
) / 2;
16 double dy
= (r
.y
+ p
.y
) / 2;
18 double t1
= bx
*dx
+ by
*dy
;
19 double t2
= ax
*cx
+ ay
*cy
;
21 double x
= (by
*t2
- ay
*t1
) / d
;
22 double y
= (ax
*t1
- bx
*t2
) / d
;